package com.software.loginregister.fragment.community;

import android.os.Bundle;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.software.loginregister.R;
import com.software.loginregister.adapter.FollowPostAdapter;

public class FollowCommunityFragment extends Fragment {
    private RecyclerView rvFollowPosts;
    private FollowPostAdapter adapter;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_follow_community, container, false);
        initViews(view);
        return view;
    }

    private void initViews(View view) {
        try {
            rvFollowPosts = view.findViewById(R.id.rv_follow_posts);
            rvFollowPosts.setLayoutManager(new LinearLayoutManager(requireContext()));
            adapter = new FollowPostAdapter(requireContext());
            rvFollowPosts.setAdapter(adapter);
        } catch (Exception e) {
            Log.e("FollowCommunityFragment", "初始化视图失败", e);
        }
    }
}